import request from '@/utils/request';

/** 查询应付款列表 */
export const getAccountsPayableListApi = (data: any) => {
  return request({
    url: '/system/accountsPayable/list',
    method: 'post',
    data: data
  });
};

/** 新增应付款记录 */
export const addAccountsPayableApi = (data: any) => {
  return request({
    url: '/system/accountsPayableRecord',
    method: 'post',
    data: data
  });
};

/** 平账历史记录 */
export const getAccountsPayableHistoryApi = () => {
  return request({
    url: '/system/accountsPayable/balanceList',
    method: 'get',
  });
};

/**获取应付款详细信息  查询付款详情*/
export const getAccountsPayableDetailApi = (id: number) => {
  return request({
    url: `/system/accountsPayable/getPayDetailList`,
    method: 'get',
    params: { id }
  });
};

/** 删除应付款 */
export const deleteAccountsPayableApi = (ids: any) => {
  return request({
    url: `/system/accountsPayable/${ids}`,
    method: 'delete',
  });
};

/** 一键平账 */
export const balanceAllApi = (id: any) => {
  return request({
    url: '/system/accountsPayable/balanceAccounts',
    method: 'put',
    params: {id}
  });
};
